﻿<ws:ApplicationView x:Class="MultiViewWithLogin.Shell.Login.LoginView" x:ClassModifier="internal" x:TypeArguments="local:ILoginViewModel"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:ws="clr-namespace:Creventive.Wpf.ShellFactory.Workspace;assembly=Creventive.Wpf.ShellFactory"
                    xmlns:local="clr-namespace:MultiViewWithLogin.Shell.Login" xmlns:m="clr-namespace:Creventive.Wpf.ShellFactory.Markup;assembly=Creventive.Wpf.ShellFactory"
                    mc:Ignorable="d"
                    Width="300"
                    Title="Login"
                    ViewModelLoaded="LoginView_ViewModelLoaded">
	<!-- The FocusManager below tells WPF to select the userNameBox text box as the initial focus point. Don't put this on the top level tag, it doesn't work. -->
	<StackPanel FocusManager.FocusedElement="{Binding ElementName=userNameBox}">
		<Border Margin="4">
			<TextBlock TextWrapping="Wrap">
				This is a demonstration of how you might accomplish a login dialog before starting the application. 
				The username is &quot;user&quot; and the password is &quot;password&quot;.
			</TextBlock>
		</Border>
		<Separator />
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="8" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="24" />
				<RowDefinition Height="24" />
			</Grid.RowDefinitions>
			<TextBlock Text="User Name:" Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" />
			<TextBlock Text="Password: " Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" />

			<TextBox x:Name="userNameBox" Grid.Column="2" Grid.Row="0" VerticalAlignment="Center" m:TextBoxService.TreatEnterAsTab="True" m:TextBoxService.AutoSelectOnFocus="True" />
			<PasswordBox x:Name="passwordBox" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" m:TextBoxService.AutoSelectOnFocus="True" />
		</Grid>
		<Separator />
		<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
			<!-- 
                The passwordbox is a real pain to work with when it comes to binding, so we'll have to do some manual work. 
                That is why I am using events and not commands in this case.
            -->
			<Button x:Name="okButton" Content="Ok" Margin="8" Width="64" Click="okButton_Click" IsDefault="True" />
			<Button x:Name="cancelButton" Content="Cancel" Margin="8" Width="64" Click="cancelButton_Click" IsCancel="True" />
		</StackPanel>
	</StackPanel>
</ws:ApplicationView>